package at.ac.lbg.media.vis.client.theme.view
{
	import mx.collections.ArrayCollection;
	
	public class Category {
		
		public var id:Number;
		public var name:String;
		public var parent:Category;
		public var index:int;
		public var isSelected:Boolean;
		public var isMainCat:Boolean;
		public var num:int;
		public var countArtworks:int;
		public var children:ArrayCollection;
		
		
		public function Category(obj:Object) { 
			super();
			id = obj.id;
			name = obj.name;
			// 2.20 is number of artworks
			countArtworks = obj.countArtworks / 2.20;
			if (obj.parent != null) {
				parent = new Category(obj.parent);
			}
			if (obj.children != null) {
				children = new ArrayCollection();
				for (var i:int = 0; i < obj.children.length; i++) {
					children.addItem(new Category(obj.children[i]));
				}
				isMainCat = true;
			}

		}

	}
}